
import type { App, Plugin } from "@vue/runtime-core";
const INSTALLED_KEY = Symbol("MY_CUSTOM_DIRECTIVES_INSTALLED");

export const makeInstaller = (directives: Plugin[] = []) => {
  const install = (app: App) => {
    if (app[INSTALLED_KEY]) return;
    app[INSTALLED_KEY] = true;
    directives.forEach(directives => { 
      app.directive(directives.name, directives.directive);
    })
  };

  return {
    install,
  };
};
